<meta charset="UTF-8">
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
        <?php
        // put your code here
        ?>
        <?php
        include("conn/conn.php");
        include ("admin/login_valid.php");

        $conn = prepare();

        $username=$_POST['username'];
        $password=$_POST['password'];
        $yanzhengma=$_POST['yanzhengma'];
        $num=$_POST['num'];

        if(strval($yanzhengma)!=strval($num)){
          echo "<script>alert('验证码输入错误!');history.go(-1);</script>";
          exit;
         }

        $stmt = exectue_sql_statement($conn, "select * from Members where members_name='$username' and members_password='$password'");
        if (sqlsrv_fetch_array($stmt) == false) {
            echo "<script type='text/javascript' charset='UTF-8'>alert('用户名或密码错误!');history.back();</script>";
            exit;
        } else {
            session_start();
            $_SESSION['username']=$username;
//       	    session_register("producelist");
//            $producelist="";
//            session_register("quatity");
//            $quatity="";
            
            echo"<script>alert('登录成功!');window.location.href='index.php';</script>";
        }
        ?>
